<?php
class classify extends table
{
	protected $_name	= 'my_classify';
	protected $fields	= array('cid',	'pid',	'name',	'snum');
	protected $_primary = 'cid';


	public static function listcls($data,$pid,$level = 0)
    {
        static $val = array();

        if(is_array($data))
        {
            foreach ($data as $d)
            {
                if($d['pid'] == $pid)
                {
                    if ($d['cid'] != '') $val[$d['cid']] = array('cid'=>$d['cid'],'parent'=>$d['pid'],'name'=>$d['name'],'level'=>$level);
                    self::listcls($data,$d['cid'],$level+1);
                }
            }
            return $val;
        }
        return false;
    }
}